Support per-call server selection for OpenAPI tools#952
Merged
RhysSullivan merged 3 commits intoJun 12, 2026
Merged
Conversation
36f9bd4 to
9145db0
Compare
9145db0 to
be10057
Compare
Resolve OpenAPI servers per tool call instead of baking a single base
URL at add time. Operations can declare multiple servers (document,
path, or operation level) and templated URLs with {variables}; each is
now selectable when invoking the tool.
- Each tool exposes an optional `server` input ({ url?, variables? }),
shown only when there is something to choose: `url` becomes an enum
when more than one server applies, and `variables` are drawn from the
applicable servers.
- Host resolution: a connection base URL override wins when set;
otherwise the call's chosen server (server.url or the first
applicable) is resolved with its {variables} (call values, else spec
defaults); otherwise no host is prepended.
- The connection base URL becomes an optional override (off by
default), required only when the spec declares no servers. The form
shows a combobox for multiple top-level servers and a plain input
otherwise, with the first server's resolved URL as the placeholder.
- Drop connection-level serverVariables in favor of per-call variables.
- Bindings persisted before this change keep working: a missing
`servers` field is treated as empty and falls back to the connection
base URL.
A multi-server spec, added through the typed product API, must turn into a
tool that advertises the per-call `server` selector: a `url` enum over the
declared servers plus the `{variables}` drawn from the templated one. The
scenario also pins the base URL as an optional override — addSpec succeeds
with no baseUrl, the host being resolved per call from the spec's servers.
Cross-target (cloud + selfhost), driven entirely through the typed client.
be10057 to
3eb8d67
Compare
Records the UI side of per-call server selection: pasting a spec that declares more than one server turns the Add OpenAPI source form's Base URL field into a picker over those servers and relabels it an optional override, with a hint that the host is otherwise chosen per tool call. The session video and step screenshots are the artifact; the scenario skips on targets without a browser surface.
Collaborator
|
thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolve OpenAPI servers per tool call instead of baking a single base URL at add time. Operations can declare multiple servers (document, path, or operation level) and templated URLs with
{variables}; each is now selectable when invoking the tool.Changes
serverinput. Each generated tool exposes an optionalserverinput ({ url?, variables? }), shown only when there is something to choose:urlbecomes an enum when more than one server applies, andvariablesare drawn from the applicable servers. This mirrors the existing syntheticcontentTypeinput.server.url, or the first applicable) is resolved with its{variables}(call values, else spec defaults); otherwise no host is prepended.serverVariablesin favor of per-call variables.Compatibility
Bindings persisted before this change keep working: a missing
serversfield is treated as empty and falls back to the connection base URL.End-to-end coverage
Two scenarios pin this behavior end to end:
e2e/scenarios/openapi-server-selection.test.ts: a multi-server spec, added through the typed API with no base URL, produces a tool whose input schema exposes the per-callserverselector — aurlenum over the declared servers plus the templated server's{variables}. Runs on cloud and selfhost.e2e/scenarios/openapi-server-selection-ui.test.ts: pasting a multi-server spec turns the add form's Base URL field into a picker over those servers and relabels it an optional override, with a hint that the host is otherwise chosen per tool call.